'use client';
import { useActionState } from 'react';
import { addItemAction, updateItemAction } from '@/lib/account/actions';
import { idle, type ActionState } from '@/lib/auth/state';
import { Field, FormMessage, Select, SubmitButton, TextArea, TextInput } from '@/components/account/form';
import { AssetPicker, type PickedAsset } from '@/components/account/asset-picker';
const CURRENCIES = ['USD', 'CAD', 'EUR', 'GBP', 'JPY', 'CHF', 'AUD'];
const GRADERS = ['', 'psa', 'bgs', 'cgc', 'sgc', 'tag', 'ace', 'cbcs', 'wata', 'vga', 'pcgs', 'ngc'];
export interface ItemInitial {
itemId: string;
asset: PickedAsset;
quantity: number;
acquiredAt: string | null;
purchasePrice: number | null;
purchaseCurrency: string | null;
source: string | null;
grader: string | null;
grade: string | null;
certificationNumber: string | null;
serial: string | null;
condition: string | null;
notes: string | null;
tags: string[];
manualValueUsd: number | null;
soldAt: string | null;
soldPriceUsd: number | null;
}
export function AddItemForm({ collectionId }: { collectionId: string }) {
const [state, action] = useActionState(addItemAction, idle);
return